home *** CD-ROM | disk | FTP | other *** search
/ My Neighborhood / My Neighborhood.iso / mac / MacFiles / Shared.Dir / 00909.ls < prev    next >
Encoding:
Text File  |  1997-11-20  |  815 b   |  26 lines

  1. on snapTo whichSprite, x, y
  2.   set the visible of sprite 20 to 0
  3.   set startH to the locH of sprite whichSprite
  4.   set startV to the locV of sprite whichSprite
  5.   set hDist to x - startH
  6.   set vDist to y - startV
  7.   if hDist > vDist then
  8.     repeat with i = 1 to hDist
  9.       set the locH of sprite whichSprite to startH + i
  10.       set the locV of sprite whichSprite to startV + (i * float(vDist) / hDist)
  11.       updateStage()
  12.     end repeat
  13.   else
  14.     repeat with i = 1 to vDist
  15.       set the locV of sprite whichSprite to startV + i
  16.       set the locH of sprite whichSprite to startH + (i * float(hDist) / vDist)
  17.       updateStage()
  18.     end repeat
  19.   end if
  20.   set the locH of sprite whichSprite to x
  21.   set the locV of sprite whichSprite to y
  22.   set the visible of sprite 20 to 1
  23.   puppetSound("poper")
  24.   updateStage()
  25. end
  26.